<?php

namespace App\Enums;

use App\Traits\EnumTrait;

class UserBlacklistEnum
{
    use EnumTrait;

    const DONE = ['status' => 1, 'text' => "拉黑"];
    const CANCEL = ['status' => 2, 'text' => "取消拉黑"];

    public static function getEnumByStatus($status)
    {
        foreach (self::getConstants() as $constant) {
            if ($constant['status'] == $status) {
                return $constant;
            }
        }
        return null;
    }

    public static function getStatus($data)
    {
        return $data['status'];
    }

    public static function getText($data)
    {
        return $data['text'] ?? '';
    }

    public static function getTextByStatus($status)
    {
        return self::getText(self::getEnumByStatus($status));
    }
}
